package de.dn3t.lib.playlist;

import java.io.File;

import org.apache.commons.io.FilenameUtils;

/**
 * Represents one item of a playlist
 * 
 * NOTICE: 
 * Commons IO is part of the Apache Commons project (http://commons.apache.org)
 * and is distributed unnder the Apache License v2.0 which can either be found under
 * etc/LICENSE-2.0.txt or online at: http://www.apache.org/licenses/LICENSE-2.0
 * 
 * @author T.Duellmann
 *
 */
public class PlaylistItem implements IPlaylistItem{
	protected File mFile;
	protected int mLength;
	protected PlaylistEntryType mType;
	protected boolean mIsAbsolute;
	//TODO: check whether a file is absolute
	
	
	public PlaylistItem(File file) {
		this.mFile = file;
	}
	
	public PlaylistItem(File file, int length) {
		this(file);
		this.mLength = length;
	}

	@Override
	public PlaylistEntryType getType() {
		return this.mType;
	}

	@Override
	public int getLength() {
		
		return this.mLength;
	}

	@Override
	public File getFile() {
		return this.mFile;
	}

	@Override
	public String getAbsolutePath() {
		return this.mFile.getAbsolutePath();
	}

	@Override
	public String getRelativePath() {
		return null;
	}

	@Override
	public String getFileName() {
		return FilenameUtils.getName(this.mFile.getName());
	}

	@Override
	public String getExtension() {
		return FilenameUtils.getExtension(this.mFile.getName());
	}

	@Override
	public boolean isRelative() {
		return !this.mFile.isAbsolute();
	}
}
